package org.niit.dao

import org.niit.util.JDBCUtil

class AreaAdDao {

  def insertAreaCityAd(day: String, area: String, city: String, ad: String, count: Int): Unit = {
    val conn = JDBCUtil.getConnection

    // 插入数据，数据存在时更新count
    JDBCUtil.executeUpdate(conn,
      "insert into area_city_ad_count values(?, ?, ?, ?, ?) on duplicate key update count = count + ?",
      Array(day, area, city, ad, count, count))

    conn.close()
  }

}
